/* -----------------------------------------------------------------------------
 * PROJECT    : net.lwf
 * FILE       : XMLReader.java
 *
 * HISTORY:
 * Date          Author                        Description
 * ----------------------------------------------------------------------------- 
 * Dec 16, 2008       Raghu Sarraff			       Created
 */
package net.lwf.xml.parser;

import java.io.File;
import java.io.IOException;

import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;

import org.w3c.dom.Document;
import org.xml.sax.SAXException;

/**
 * Type the class description here
 *  
 */
public class XMLReader {
	
	public Document getDocument(String location) {
		File file = new File(location);
		DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
		DocumentBuilder db = null;
		Document document = null;
		try {
			db = dbf.newDocumentBuilder();
			document = db.parse(file);
		}
		catch (ParserConfigurationException pcex) {
			
		}
		catch(IOException ioex) {
			ioex.getMessage();
			ioex.printStackTrace();
		}
		catch(SAXException sex) {
			sex.getMessage();
			sex.printStackTrace();
		}
		
		return document;
	}

}

